﻿using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
namespace BBMS.DLL.DataContract
{
    public class CTyThuHoList : BBMS.DLL.Base.ObjectList
    {
        public override void LoadData()
        {
            if (hash == null) hash = new System.Collections.Hashtable();
            CTyThuHo obj = new CTyThuHo();
            hash.Clear();
            try
            {
                MySqlConnection con = new MySqlConnection(Base.Config.ConnectionString());
                con.Open();
                MySqlCommand cmd = con.CreateCommand();
                cmd.CommandText = "select * from " + obj.TableName;
                MySqlDataReader rd = cmd.ExecuteReader();

                while (rd.Read())
                    this.Add(obj.DataReaderToObject(rd));

                rd.Close();
                rd.Dispose();
                con.Close();
                con.Dispose();
            }
            catch
            {
                this.hash.Clear();
            }
        }
    }
}
